package com.leyou.auth.controller;


import com.leyou.auth.service.CallbackService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/callback")
public class CallbackController {
    @Resource
    private CallbackService callbackService;

    @PostMapping("/self")
    public ResponseEntity callbackFilename(@RequestBody Map<String,String> map){
        callbackService.getSelfImage(map);
        return ResponseEntity.ok(null);
    }

    @PostMapping("/oss")
    public ResponseEntity<String> callbackFilename(@RequestParam("filename")String filename){
        String ossImage = callbackService.getOssImage(filename);
        System.out.println("ossImage = " + ossImage);
        return ResponseEntity.ok(ossImage);
    }
}
